import { LoadingController } from "ionic-angular";

export class LoadingUtil {
    loader: any;
    loadingCtrl: LoadingController;
    constructor(loadingCtrl: LoadingController) {
        this.loadingCtrl = loadingCtrl;
    }
    showLoading() {
        if (this.loader == null) {
            this.loader = this.loadingCtrl.create({
                content: "正在加载...",
            });
        }
        this.loader.present();
    }

    hideLoading() {
        if (this.loader != null) {
            this.loader.dismiss().then(() => {
                this.loader = null;
            });
        }
    }

}